<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>
		<input type="button" id="" value="" onclick="a()" />
		<br />
		<button onclick="test()">无参</button>
		<button onclick="test1('张三')">有参</button>
		<button onclick="document.write(test2('李四'))">有参有返回值</button>
		<button onclick="document.write(test3())">无参有返回值</button>
		<button onclick="test4(prompt('请输入查询的科目总数',''))">输入成绩</button>
		<button onclick="test5()">计算器</button>
		<script type="text/javascript">
			function test5() {
				var a = prompt("请输入数字", "");
				var a1 = parseFloat(a);
				var b = prompt("请输入运算符", "");
				var c = prompt("请输入第二个", "");
				var c1 = parseFloat(c);
				if(b == "+") {
					document.write(a + b + c + "=" + (a1 + c1));
				} else if(b == "-") {
					document.write(a + b + c + "=" + (a1 - c1));
				} else if(b == "*") {
					document.write(a + b + c + "=" + (a1 * c1));
				} else if(b == "/") {
					document.write(a + b + c + "=" + (a1 / c1));
				} else if(b == "%") {
					document.write(a + b + c + "=" + (a1 % c1));
				} else {
					document.write("请输入正确的运算符");
				}
			}
			function test4(count) {
				var d=0;
				for(var i = 0; i < count; i++) {
					do {
						var a = prompt("请输入数字", "")
						var b = parseFloat(a);
						c = isNaN(b);
					} while (c);
					d = d + b;
				}
				document.write(count+"个科目的总成绩："+d);
			}

			function test() {
				var a = 12;
				document.write(a);
			}

			function test1(name) {
				document.write(name);
			}

			function test2(name) {
				return name;
			}

			function test3() {
				return "王五";
			}
			document.write(test3());
			var a = [12, 12, 121222, 213, 112];
			for(var i in a) {
				document.write("<br />" + a[i]);
			}
			document.write("<br />数组的长度:" + a.length);
			document.write("<br />数组分割:" + a.join("分割"));
			var c = ["asd", "dasd", "wdaa", "as"];
			//按照字符串排序（不能排序数字）
			document.write("<br />数组排序:" + c.sort());
			document.write("<br />数组添加后的长度:" + a.push("12", "dda"));
			document.write("<br />新数组:" + a);
			for(var i = 1; i < 100; i++) {
				if(i == 50) {
					break;
				} else if(i == 30) {
					continue;
				} else {
					document.write(i);
				}
			}
			var a = 12;
			var b = isNaN(a);
			//alert(b);
			//alert("弹出窗口")
			//var sss=prompt("请输入","")
			//alert("你输入的是："+sss);
			//对象
			var Flower = new Object();
			Flower.name = "长春花";
			Flower.address = "非洲，热带";
			Flower.use = "观赏，使用";
			Flower.showName = function() {
				document.write("<br />" + this.name); //弹出花名
			}
			Flower.showName();
			//对象
			var Flower1 = {
				name: "玫瑰花",
				address: "中国",
				showName: function() {
					document.write("<br />" + this.name)
				}
			}
			Flower1.showName();
			//构造函数
			function Flower2(name, address, use) {
				this.name = name;
				this.address = address;
				this.use = use;
				this.showName = function() {
					document.write("<br />" + this.name)
				}
			}
			var flower = new Flower2("牵牛花", "中国", "牵牛");
			flower.showName();
			//浏览器打开
			function a() {
				var flag = confirm("是否删除");
				if(flag == true) {
					window.open("index1.html");
				} else {
					window.close();
				}
			}
		</script>
	</body>

</html>